package com.example.freshfoodproject.service.impl;

import com.example.freshfoodproject.entry.Shopping;
import com.example.freshfoodproject.mapper.ShoppingMapper;
import com.example.freshfoodproject.service.ShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoopingServiceImpl implements ShoppingService {
    @Autowired
    private ShoppingMapper shoppingMapper;

    @Override
    public List<Shopping> findAll() {
        return shoppingMapper.selectAll();
    }

    @Override
    public boolean addOne(Shopping shopping) {
        return shoppingMapper.insertOne(shopping)==1?true:false;
    }

    @Override
    public boolean updateOne(Shopping shopping) {
        return shoppingMapper.updateOne(shopping)==1?true:false;
    }

    @Override
    public boolean removeOne(String purchaseItems) {
        return shoppingMapper.deleteOne(purchaseItems)==1?true:false;
    }
}
